#include "TestSortingAlgorithms.h"
#include "RandomData.h"
#include "Tests.h"
#include <iostream>
using namespace std;
void TestSortingAlgorithms::StartTesting()
{
    FILE *fp = fopen("Results.txt", "w");
    fprintf(fp, "These are the results from the tests with pseudo random data:");
    fclose(fp);
    cout << "Pseudo tests starting:\n";
    this -> PseudoTest(10000);
    cout << "\n";
    this -> PseudoTest(20000);
    cout << "\n";
    this -> PseudoTest(30000);
    /*cout << "\n";
    this -> PseudoTest(40000);
    cout << "\n";
    this -> PseudoTest(50000);
    cout << "\n";
    this -> PseudoTest(60000);
    cout << "\n";
    this -> PseudoTest(70000);
    cout << "\n";
    this -> PseudoTest(80000);
    cout << "\n";
    this -> PseudoTest(90000);
    cout << "\n";
    this -> PseudoTest(100000);
    cout << "\n";
    this -> PseudoTest(110000);
    cout << "\n";
    this -> PseudoTest(120000);
    cout << "\n";
    this -> PseudoTest(130000);
    cout << "\n";
    this -> PseudoTest(140000);
    cout << "\n";
    this -> PseudoTest(150000);*/
    cout << "\n";
    fp = fopen("Results.txt", "a");
    fprintf(fp, "\nThese are the results from the tests with real random data:");
    fclose(fp);
    cout << "RandomOrg tests starting:\n";
    RandomOrgTest(10000);
    cout << "\n";
    RandomOrgTest(20000);
    cout << "\n";
    RandomOrgTest(30000);
    /*cout << "\n";
    RandomOrgTest(40000);
    cout << "\n";
    RandomOrgTest(50000);
    cout << "\n";
    RandomOrgTest(60000);
    cout << "\n";
    RandomOrgTest(70000);
    cout << "\n";
    RandomOrgTest(80000);
    cout << "\n";
    RandomOrgTest(90000);
    cout << "\n";
    RandomOrgTest(100000);
    cout << "\n";
    RandomOrgTest(110000);
    cout << "\n";
    RandomOrgTest(120000);
    cout << "\n";
    RandomOrgTest(130000);
    cout << "\n";
    RandomOrgTest(140000);
    cout << "\n";
    RandomOrgTest(150000);*/
    cout << "\n";
    fp = fopen("Results.txt", "a");
    fprintf(fp, "\nThese are the results from the tests with worst case data:");
    fclose(fp);
    cout << "Worst case tests starting:\n";
    WorstCaseTest(10000);
    cout << "\n";
    WorstCaseTest(20000);
    cout << "\n";
    WorstCaseTest(30000);
    /*cout << "\n";
    WorstCaseTest(40000);
    cout << "\n";
    WorstCaseTest(50000);
    cout << "\n";
    WorstCaseTest(60000);
    cout << "\n";
    WorstCaseTest(70000);
    cout << "\n";
    WorstCaseTest(80000);
    cout << "\n";
    WorstCaseTest(90000);
    cout << "\n";
    WorstCaseTest(100000);
    cout << "\n";
    WorstCaseTest(110000);
    cout << "\n";
    WorstCaseTest(120000);
    cout << "\n";
    WorstCaseTest(130000);
    cout << "\n";
    WorstCaseTest(140000);
    cout << "\n";
    WorstCaseTest(150000);*/
    cout << "\nDone.";
}
void TestSortingAlgorithms::PseudoTest(long n)
{
    RandomData X = RandomData();
    X.generatePseudoData(n);
    X.readRandomDataFile("PseudoData.txt", n);
    long *data = X.getRandomData(n);
    Tests T;
    T.testAlgorithms(data, n, true);
}
void TestSortingAlgorithms::RandomOrgTest(long n)
{
    RandomData X = RandomData();
    X.readRandomDataFile("RandomOrgData.txt", n);
    long *data = X.getRandomData(n);
    Tests T;
    T.testAlgorithms(data, n, true);
}
void TestSortingAlgorithms::WorstCaseTest(long n)
{
    RandomData X = RandomData();
    X.generateWorstCaseData(n);
    X.readRandomDataFile("WorstCaseData.txt", n);
    long *data = X.getRandomData(n);
    Tests T;
    T.testAlgorithms(data, n, false);
}

